﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace DTO
{
    public static class Utility
    {
        public static void LogEx(Exception ex)
        {
            StreamWriter file = new StreamWriter(Application.StartupPath + @"\log.txt", true);
            string lines = ex.TargetSite.ToString();
            file.WriteLine("Target Site:");
            file.WriteLine("        " + lines);
            lines = ex.StackTrace.ToString();
            file.WriteLine("Stack Trace:");
            file.WriteLine("        " + lines);
            lines = ex.Source;
            file.WriteLine("Source:");
            file.WriteLine("        " + lines);
            lines = ex.Message;
            file.WriteLine("Message:");
            file.WriteLine("        " + lines);

            file.WriteLine();
            file.WriteLine("======= ========= ========= ======= ======== ======= ========= ======");
            //lines = ex.InnerException.ToString();
            //file.Write(lines);
            //lines = ex.HelpLink;
            //file.Write(lines);
            //lines = ex.Data.ToString();
            //file.Write(lines);

            file.Close();
        }
    }
}
